﻿CREATE PROCEDURE [dbo].[proc_RefeicoesInsert]
(
	@IdRefeicaoContratada bigint,
	@DataRefeicao date,
	@TotalVendasPrevisto decimal(18,5) = NULL,
	@TotalCustosPrevisto decimal(18,5) = NULL,
	@TotalVendasEfectivo decimal(18,5) = NULL,
	@TotalCustosEfectivo decimal(18,5) = NULL,
	@RacioMPrimasPrevisto decimal(18,5) = NULL,
	@RacioMPrimasEfectivo decimal(18,5) = NULL
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	INSERT
	INTO [Refeicoes]
	(
		[IdRefeicaoContratada],
		[DataRefeicao],
		[TotalVendasPrevisto],
		[TotalCustosPrevisto],
		[TotalVendasEfectivo],
		[TotalCustosEfectivo],
		[RacioMPrimasPrevisto],
		[RacioMPrimasEfectivo],
		[DataCriacao],
		[DataAlteracao]
	)
	VALUES
	(
		@IdRefeicaoContratada,
		@DataRefeicao,
		@TotalVendasPrevisto,
		@TotalCustosPrevisto,
		@TotalVendasEfectivo,
		@TotalCustosEfectivo,
		@RacioMPrimasPrevisto,
		@RacioMPrimasEfectivo,
		GETDATE(),
		GETDATE()
	)

	SET @Err = @@Error


	RETURN @Err
END
